package com.itcast.demo.validate.pojo;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author SuQianLong
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class UserGroup {

    public interface GroupA {}
    public interface GroupB {}

    @NotBlank(message = "用户ID不能为空", groups = {GroupA.class})
    private String userId;
    @NotBlank(message = "用户名不能为空", groups = {GroupA.class, GroupB.class})
    private String name;
    @Email(message = "邮箱格式不正确", groups = {GroupB.class})
    private String email;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}

